home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.hitl.washington.edu
/
ftp.hitl.washington.edu.tar
/
ftp.hitl.washington.edu
/
pub
/
people
/
tsoper
/
CT Explorer
/
ViewPanel.cs
< prev
next >
Wrap
Text File
|
2005-06-08
|
3KB
|
116 lines
using System;
using System.Windows.Forms;
using System.Drawing;
using SampleGUI;
public class ViewPanel : Panel
{
//declarations
//MAKE THESE PRIVATE
public SliceView mainSliceView; // main view
private SliceView[] orthoSliceView; //smaller orthogonal views
private System.Windows.Forms.Panel mainViewPanel; //panel to hold main view
private System.Windows.Forms.Panel orthoViewBigPanel; //panel to hold all ortho views
private System.Windows.Forms.Panel[] orthoViewPanel; //panels to hold each ortho view
//TAKE THIS OUT
public Label lbl;
public ViewPanel()
{
//instantiate controls
mainSliceView = new SliceView();
orthoSliceView = new SliceView[3];
mainViewPanel = new Panel();
orthoViewBigPanel = new Panel();
orthoViewPanel = new Panel[3];
for(int i = 0; i < 3; i++)
{
orthoSliceView[i] = new SliceView();
orthoViewPanel[i] = new Panel();
}
//suspend layout
this.SuspendLayout();
//set containers
mainViewPanel.Controls.Add(mainSliceView);
for(int i = 0; i < 3; i++)
{
orthoViewPanel[i].Controls.Add(orthoSliceView[i]);
orthoViewBigPanel.Controls.Add(orthoViewPanel[i]);
}
this.Controls.Add(mainViewPanel);
this.Controls.Add(orthoViewBigPanel);
//set Dock Styles and border styles
mainSliceView.Dock = DockStyle.Fill;
for(int i = 0; i < 3; i++)
{
orthoSliceView[i].Dock = DockStyle.Fill;
orthoViewPanel[i].Dock = DockStyle.Right;
orthoViewPanel[i].BorderStyle = BorderStyle.Fixed3D;
}
orthoViewBigPanel.BorderStyle = BorderStyle.Fixed3D;
mainViewPanel.BorderStyle = BorderStyle.Fixed3D;
//set the view planes
mainSliceView.ViewType = VIEW_TYPE.CORONAL;
mainSliceView.IsRotatable = true;
mainSliceView.IsZoomable = true;
mainSliceView.eye.MaxZoom = 5.0f;
mainSliceView.eye.MinZoom = 0.2f;
mainSliceView.lbl = lbl; //TAKE THIS OUT
orthoSliceView[0].ViewType = VIEW_TYPE.TRANSVERSE;
orthoSliceView[0].IsRotatable = false;
orthoSliceView[1].ViewType = VIEW_TYPE.SAGITTAL;
orthoSliceView[1].IsRotatable = false;
orthoSliceView[2].ViewType = VIEW_TYPE.CORONAL;
orthoSliceView[2].IsRotatable = false;
//resume layout
this.ResumeLayout();
this.Resize += new EventHandler(ViewPanel_Resize);
}
public void ViewPanel_Resize(object sender, EventArgs e)
{
int cx,cy;
cx = this.ClientSize.Width;
cy = this.ClientSize.Height;
//set the main view and ortho big panels first
mainViewPanel.SetBounds(0,0,cx,(int)(cy*3/4.0));
orthoViewBigPanel.SetBounds(0,(int)(cy*3/4.0),cx,(int)(cy/4.0));
//set the the ortho view panels second
cx = orthoViewBigPanel.Width;
cy = orthoViewBigPanel.Height;
for(int i = 0; i < 3; i++)
orthoViewPanel[i].Size = new Size((int)(cx/3.0),cy);
}
public void LoadScan( Scan s )
{
mainSliceView.DisplayFromBuffer = true;
mainSliceView.LoadScan(s);
for(int i = 0; i < 3; i++)
orthoSliceView[i].LoadScan( s);
//set the draw quality of the main panel to high
//smaller ortho views are defaulted to low quality
mainSliceView.DrawQuality = DRAW_QUALITY.HIGH;
//set the view type of mainSlice to ortho3D
//smaller ortho views are defaulted to orthoD
//mainSliceView.ViewType = VIEW_TYPE.ORTHO_3D;
}
}